#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>

int main() {
    const char *original = "Hello, World!";
    char *copy = strdup(original);

    if (copy != NULL) {
        printf("Original: %s\n", original);
        printf("Copy: %s\n", copy);
        std::cout << std::endl;

        // 使用完后，记得释放复制的内存
        free(copy);
    } else {
        printf("Memory allocation failed!\n");
        std::cout << std::endl;
    }

    return 0;
}